package edu.udo.sopra10.chaturaji.entities.pieces;

import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableCollection;

import java.util.Collection;

import edu.udo.sopra10.chaturaji.entities.Player;
import edu.udo.sopra10.chaturaji.entities.Square;
import edu.udo.sopra10.chaturaji.entities.coordinates.Movement;

/**
 * A king is one of the Chaturaji {@link Piece}s. It is worth five points.
 * Players start with a single king in the rightmost square of their second row.
 * Kings move exactly one square into any direction (including diagonals),
 * capturing opposing pieces they land on.
 * 
 * @author Simon Dierl
 */
public final class King extends JumpingPiece {
	/**
	 * All movements a king is theoretically capable of performing.
	 */
	private static final Collection<Movement> MOVEMENTS = unmodifiableCollection(asList(
			new Movement((byte) -1, (byte) -1), new Movement((byte) -1,
					(byte) 0), new Movement((byte) -1, (byte) 1), new Movement(
					(byte) 0, (byte) -1), new Movement((byte) 0, (byte) 1),
			new Movement((byte) 1, (byte) -1),
			new Movement((byte) 1, (byte) 0), new Movement((byte) 1, (byte) 1)));

	/**
	 * Create a new {@link King}.
	 * 
	 * @param owner
	 *            the player owning the king, must not be {@code null}.
	 * @param square
	 *            the square the king stands on, may be {@code null} to indicate
	 *            a captured piece.
	 */
	public King(final Player owner, final Square square) {
		super(MOVEMENTS, (byte) 5, owner, square);
		this.pieceValue = 40;
	}
}
